<template>
    <el-container>
        <el-header>
            <el-menu
                class="el-menu-demo el-menu"
                mode="horizontal"
                @select="menuActive"
                :default-active="this.$route.path.match(/\w+$/)[0]"
            >
                <el-menu-item index='employee' >员工列表</el-menu-item>
                <el-menu-item index="setting" >编辑员工</el-menu-item>
            </el-menu>
        </el-header>
        <el-main>
            <router-view></router-view>
        </el-main>
        <el-footer>
            Vue App
        </el-footer>
    </el-container>
</template>

<script>
    export default {
        methods: {
            menuActive(index) {
                let currentPath = this.$route.path.match(/\w+$/)[0]
                if (currentPath !== index) {
                    this.$router.push(`/dashboard/${index}`)
                }
            }
        },
    }
</script>

<style lang="css">
*{
    margin: 0;
    padding: 0;
}
.el-menu{
    width: 1170px;
    margin: 0 auto;
}
 .el-header{
    background-color: #fff !important;
 }
 .el-header, .el-footer {
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    /* line-height: 160px; */
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>